<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03input输入类型</title>
    <script>
        window.onload = function(){
            var txt = document.getElementById("txt");
            document.getElementsByTagName("button")[0].onclick = function(){
                alert(typeof txt.value);
                alert(typeof Number(txt.value));
            }
        }
    </script>
</head>
<body>
<input type="text" id="txt">
<button>点击</button>
</body>
</html>